﻿using System;
using System.Collections.Generic;
using System.Text;
using Tree.Container;
using Tree.Factory;
using Tree.Injector;
using Tree.Injector.Impl;
using Tree.Factory.Impl;
using Tree.Container.Impl;
using Tree.Runner;

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

namespace Tree
{
    /// <summary>
    /// Tree framework Core Objects.
    /// </summary>
    public class Core
    {
        static Core()
        {
            injector = new DependencyInjectorImpl();
            resolver = new ResolverImpl();
            factory = new ObjectFactoryImpl();
            container = new ObjectContainerImpl();
        }

        private static IObjectContainer container; 
        private static IObjectFactory factory;
        private static IResolver resolver;
        private static IDependencyInjector injector;

        /// <summary>
        /// Gets the Object Container.
        /// </summary>
        public static IObjectContainer Container
        {
            get
            {
                return container;
            }
        }

        /// <summary>
        /// Gets the Object Factory.
        /// </summary>
        public static IObjectFactory Factory
        {
            get
            {
                return factory;
            }
        }

        /// <summary>
        /// Gets the Object Type Resolver.
        /// </summary>
        public static IResolver Resolver
        {
            get
            {
                return resolver;
            }
        }

        /// <summary>
        /// Gets the Object Dependency Injector.
        /// </summary>
        public static IDependencyInjector Injector
        {
            get
            {
                return injector;
            }
        }

        /// <summary>
        /// Dummy method to start all static objects.
        /// </summary>
        public static void Start()
        {
            container.Start();
        }

        /// <summary>
        /// Dummy method to stop the Core Application.
        /// </summary>
        public static void Stop()
        {
            container.Stop();
        }

        /// <summary>
        /// Run the Application under Dromeas.
        /// </summary>
        /// <param name="args">Arguments to the starting application.</param>
        public static void Run(string[] args)
        {
            new Dromeas().Run();
        }
    }
}
